package com.xiangge.test;

import java.util.Arrays;

public class Demo4 {
    public static void main(String[] args) {
        int[] arr = {1, 3,5,7, 9, 1, 0, 1,5};
        int[] arr2 = new int[6];

        for (int i = 0; i < arr.length; i++) {

            if (buchongfu(arr, arr2, i)) {
                arr2[i]=arr[i];
            }
        }

        System.out.println(Arrays.toString(arr2));
    }
    private static boolean buchongfu(int[] arr, int[] arr2, int i) {
        for (int j = 0; j < arr2.length; j++) {
            if (arr[i]== arr2[j]){
                return false;
            }
        }
        return true;
    }
}
